UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y4J/9ScmSv465jGVHeLSuWQC6DtNpg1rMVdhTpgtvuw=' 
WHERE 
  key_id = '2c7e8311defd0c5902432969e3f921483d3c11fada976059dacd822d981979f4' 
  AND (
    token = 'Y4J/9ScmSv465jGVHeLSuWQC6DtNpg1rMVdhTpgtvuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031