UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XKB/3wimkf4uHthJPba3fo40PuKxYYJKV7PeZgypjHI='
WHERE
key_id = 'c6fcb50cfdd8f9df3c3fcb0325a0492e295fac59f55c661c3ec405ba64eb0884'
AND (
token = 'XKB/3wimkf4uHthJPba3fo40PuKxYYJKV7PeZgypjHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)