UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKhz5laO7n1+Y5TCW7B+ELrASSl6fzSh+Yvj/OofQeo='
WHERE
key_id = '8e1ac80717ca8d9ecedb035fb5265b39de084300f8c1473579331a4d08550000'
AND (
token = 'gKhz5laO7n1+Y5TCW7B+ELrASSl6fzSh+Yvj/OofQeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)