UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qh6h794KGGFupyIlEtb+m7NuawMbRwzndfjJiG8PGI8=' 
WHERE 
  key_id = '6129a9f30ed01ca9877bce73f58542be671c33d1cfb204fe9279de2c97770aa6' 
  AND (
    token = 'Qh6h794KGGFupyIlEtb+m7NuawMbRwzndfjJiG8PGI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023