UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Obr4ifGevwyA5TRdhJ84B7M+pZ8GsjcZjVnAVh8Lef8='
WHERE
key_id = '49d70a0b170894a93834026f827a3f2fcd5206ce3427833e49de3427e601db05'
AND (
token = 'Obr4ifGevwyA5TRdhJ84B7M+pZ8GsjcZjVnAVh8Lef8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)