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

Query time 0.00021