UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3dOQwxZ1Q1/eshays2U7BvLJGw062ctjkB/THFLRCSY='
WHERE
key_id = '24bed8b29f671417a8fb443c35a945c78e26a0710526046174b4a70d96e95d5d'
AND (
token = '3dOQwxZ1Q1/eshays2U7BvLJGw062ctjkB/THFLRCSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)