UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZKwjjjlYGMLUyekzoIa6dW2yJ8edTCp+K8yS2l827dg='
WHERE
key_id = '12a5d25b7b07d522d58b7f9dabb931877f8996ff6df7f994708cf3da32e123af'
AND (
token = 'ZKwjjjlYGMLUyekzoIa6dW2yJ8edTCp+K8yS2l827dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)