UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z0VsvdIjBwjPt5SJase2d3yo5V+Bo1xzF67gyTk2NUM='
WHERE
key_id = 'f8865084f4fc8a4381e11fd4886bc597d9292923366503893bad8555b6bea289'
AND (
token = 'Z0VsvdIjBwjPt5SJase2d3yo5V+Bo1xzF67gyTk2NUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)