UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hvAoYq8G7ayvgz1AN6Hnj/XOvF6+fGAdvuCmo8xZbnw='
WHERE
key_id = 'b1b7c4681b8937f5b4b69c04fce29757863f78e425ea01010c465c5bb31d09fd'
AND (
token = 'hvAoYq8G7ayvgz1AN6Hnj/XOvF6+fGAdvuCmo8xZbnw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)