UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TkevrhSyJnVOlLxcmEDxqqItJHnIFXpDprHswNLfGK8=' 
WHERE 
  key_id = '9e83781afac5ce2959f6575efe8a45c38c4209e7e70d9b79172f4e8b0208b878' 
  AND (
    token = 'TkevrhSyJnVOlLxcmEDxqqItJHnIFXpDprHswNLfGK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018