UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QBqcfWVS6T8HYy/oW8FUasqDlsNbnuRVmUCx3jy31fI='
WHERE
key_id = '10a54722cfb7bb6ed017985ab72338d672b451664c7daa64f5e46bb3941da08f'
AND (
token = 'QBqcfWVS6T8HYy/oW8FUasqDlsNbnuRVmUCx3jy31fI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)