UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ERvou+eKvZq5wJ07dnt4l3hNqFL0uC9YTlWmhFtU1LA=' 
WHERE 
  key_id = 'caa852a97d72ab7dcd6f97c8b5ce3f8ca8e1b882d265f43c59cc771225e81710' 
  AND (
    token = 'ERvou+eKvZq5wJ07dnt4l3hNqFL0uC9YTlWmhFtU1LA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037