UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pju7HhBvc1bKFV4+dSxmL6fybepTp3wzY1TI4gbj3c8='
WHERE
key_id = 'b2a18afca024e4dbeee6280768ebfe9c0047b0d09b8aadc1cd8aa7d645fd7d99'
AND (
token = 'Pju7HhBvc1bKFV4+dSxmL6fybepTp3wzY1TI4gbj3c8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)