UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ez83eVfaEKsjKkTyPQqfYJlyVFn+xFJK51FCR8b+YxE='
WHERE
key_id = 'b542ca8f4223386ecff1913968ac7e8158ef7f1dcfd3699fef3345b6b00b1227'
AND (
token = 'ez83eVfaEKsjKkTyPQqfYJlyVFn+xFJK51FCR8b+YxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)