UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3BrDF801XRcZ8WLLM9ceEgC5UCCMrGLJtIvUxNT4Id0='
WHERE
key_id = 'ca447091d5179991475cad8f1bccf3350f68c31b7a25ef3d749ebb3cff9134f7'
AND (
token = '3BrDF801XRcZ8WLLM9ceEgC5UCCMrGLJtIvUxNT4Id0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)