UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't9rMOy7nee0FtP8361N6X99P8Rqbv1pO3EVr0oe2zD0='
WHERE
key_id = 'ca3a1b5f621a8da39af057f3c699b5e043761cb94a937f0f74c2ad6a1ecf12ed'
AND (
token = 't9rMOy7nee0FtP8361N6X99P8Rqbv1pO3EVr0oe2zD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)