UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2I3XBQ6+ZS0U69h8gRA4jMZoBB3x2h77hOdUMQxILqo=' 
WHERE 
  key_id = '1dde84c1842e2ceafba2e1c235a37a239398474af7af87e747adcf2db3828777' 
  AND (
    token = '2I3XBQ6+ZS0U69h8gRA4jMZoBB3x2h77hOdUMQxILqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030