UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ykIarnhelqzN/0BGkdbsC40We22oSvn4uruNoEXxUmI=' 
WHERE 
  key_id = '6fedc32d15a3cc5605eb09764df07fbbcd10b5540e773d878be257b39e2b5994' 
  AND (
    token = 'ykIarnhelqzN/0BGkdbsC40We22oSvn4uruNoEXxUmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048