UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yYgUGJ2XL2t6TZXBfdWPpdBoRN3Hy8u6JnF4Aek/5EM=' 
WHERE 
  key_id = '3a115953dbee9e409999dea6ac8bcea0927565c40424d58060914e479464faa9' 
  AND (
    token = 'yYgUGJ2XL2t6TZXBfdWPpdBoRN3Hy8u6JnF4Aek/5EM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029