UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hi0xyEhJH4uQS8yHkt62Qw6xDlLEzTGHBxZ8Gh2hEYA='
WHERE
key_id = 'bb67e9573bebc66bcec781670f98b394f2c5a16fc9b0ef382ca8223f0e56407d'
AND (
token = 'hi0xyEhJH4uQS8yHkt62Qw6xDlLEzTGHBxZ8Gh2hEYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)