UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KmE9LB4YoyTGHKpnj9ope3gbv4uJ4Jspfa2FGXJXDG8=' 
WHERE 
  key_id = '7b6388f81bf80fa63c098ce945239cf4ddce957cfd1c91183803dbabd40008cc' 
  AND (
    token = 'KmE9LB4YoyTGHKpnj9ope3gbv4uJ4Jspfa2FGXJXDG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030