UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '86fiZM5cKCJGe80bgOV0zoS4Kx5baHN4sG8wPpKxFzk='
WHERE
key_id = '591b88311d29421864986e8fcab1d846bd56d16f6d8be6fb6eb3834e3a01a63d'
AND (
token = '86fiZM5cKCJGe80bgOV0zoS4Kx5baHN4sG8wPpKxFzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)