UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9PK1xtE0LqQ9xYvFe8OnKy5OW7i8gK1N3XomWq7Hfw=' 
WHERE 
  key_id = '9780e416569101cc9ac6f7dce42cdcfdc97ff208b8193d59448d8881331fccef' 
  AND (
    token = 'x9PK1xtE0LqQ9xYvFe8OnKy5OW7i8gK1N3XomWq7Hfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031