UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c7rWRLBAdfJG4rCbdobUmlP2RV4zYdHbFZ0Y8wF1kdM=' 
WHERE 
  key_id = 'e3b1dba037bbb02225edcde0aa4dbb4d50c2880938638ec2ab90292d4b6767a5' 
  AND (
    token = 'c7rWRLBAdfJG4rCbdobUmlP2RV4zYdHbFZ0Y8wF1kdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046