UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iW5U6b2mgRzxtijjDt3zRvjz6z4iJG3f/sow6wl4p9o=' 
WHERE 
  key_id = '0521f71e63ada462119dc0325f0df211c19dcc1ace50c23b666a68aae3244a84' 
  AND (
    token = 'iW5U6b2mgRzxtijjDt3zRvjz6z4iJG3f/sow6wl4p9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041