UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iUaHqCOz9Bj+bewUrZZ8ZDCe8lXZ+dnSFNm8zU7nOSg='
WHERE
key_id = 'b4ce67b235a3c54218e9bb7e0f93c2e8570f7442484c09edeece7f8a4435c4dd'
AND (
token = 'iUaHqCOz9Bj+bewUrZZ8ZDCe8lXZ+dnSFNm8zU7nOSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)