UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2GHk8b4N7Wh6yCeDB8WM+OlMWNxWRPA1XGxyXx4IhE=' 
WHERE 
  key_id = '52a368780c832e73e3021625f7cf965737a59c03918a60e48b50acbfc43add8a' 
  AND (
    token = 'n2GHk8b4N7Wh6yCeDB8WM+OlMWNxWRPA1XGxyXx4IhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025