UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'juF3Ay+jQiuRoWYL60NNGDyjPE3aq0E0XbctU9R5A20=' 
WHERE 
  key_id = 'c0e39029ccf4ecc60f72c18cadc623f3c892c14b55864447a3babeb1c841b465' 
  AND (
    token = 'juF3Ay+jQiuRoWYL60NNGDyjPE3aq0E0XbctU9R5A20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057