UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kndGhk8EBVz7XOtX79yV48WT8nWY8hRKz8h3lKiCHbQ='
WHERE
key_id = 'c69978da1ebd692d25458aa6f9182b4f245e1b83d69ff8b2a2fd73b29d2694a0'
AND (
token = 'kndGhk8EBVz7XOtX79yV48WT8nWY8hRKz8h3lKiCHbQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)