UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RpD/HYgDHaJZe1RRkuHzNl4gYvGRDc5GzIrUoaNcv4E=' 
WHERE 
  key_id = '1ea8fd4b6889381b6fd7a834a06331243418b6c064f4113a43336aa35f7609a7' 
  AND (
    token = 'RpD/HYgDHaJZe1RRkuHzNl4gYvGRDc5GzIrUoaNcv4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028