UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ctqg7pXhtbbflkSlQ4pAZwMV4USD+vfHIqukQPTjlyU='
WHERE
key_id = '87fcca159e70ba23565ec6f2e8b1adaa584a246a14bb59277a27bb4be3cf119a'
AND (
token = 'ctqg7pXhtbbflkSlQ4pAZwMV4USD+vfHIqukQPTjlyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)