UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dKMW5XiOn5bbi2pl1Fj1agbYSIP1SXhuqJzrDLlcYpw=' 
WHERE 
  key_id = '03880de9449e84da51e552e2fd833fd88540e00d964a73f37058e9b8058149c3' 
  AND (
    token = 'dKMW5XiOn5bbi2pl1Fj1agbYSIP1SXhuqJzrDLlcYpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021