UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KK7BK40NUT59pO6L2WbHMHCQ9oG/WqWRmeO9g/CQII8='
WHERE
key_id = '74b15456980328fb3f11b6183215e6a2a3841b56b2ee77b7eb0f6309764ad4d2'
AND (
token = 'KK7BK40NUT59pO6L2WbHMHCQ9oG/WqWRmeO9g/CQII8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)