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