UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dMcdQlwW77jBySb0BvtRr3njayhDiG1lyp+W3+ToLdE=' 
WHERE 
  key_id = '7ac34bd7cc7e6b2eb86e285c8a578bc06896e97c683573ba8e61d6445170eec5' 
  AND (
    token = 'dMcdQlwW77jBySb0BvtRr3njayhDiG1lyp+W3+ToLdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017