UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uoiBVrzXeXiJpJdkq68sybprOCVx1oFqMnlPWiWRORk=' 
WHERE 
  key_id = '956f1978b21931e0f06b8b3de75b9d9807718c6ac07b9bf462b711ea32d573ae' 
  AND (
    token = 'uoiBVrzXeXiJpJdkq68sybprOCVx1oFqMnlPWiWRORk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026