UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k19EO79EroNWPNg5YuvhiWykpGkwTGoiu5g3tzgrBAA='
WHERE
key_id = '76ef80d5562df6d52c66e3e616d356924530e9c1f4e92b877ae31d9499cd3a0e'
AND (
token = 'k19EO79EroNWPNg5YuvhiWykpGkwTGoiu5g3tzgrBAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)