UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ptZ8JJyTTy+pjfkcTez/b7UB/8ANUJ1Q8DgODwgBuko='
WHERE
key_id = 'a9b2135cbe9c074a277bb2e0d3b92fe02034ef091ae27b7604505817922445fc'
AND (
token = 'ptZ8JJyTTy+pjfkcTez/b7UB/8ANUJ1Q8DgODwgBuko='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)