UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QPVPwrZ3T5eKASEg5frbt68akKiyeSPMWoGLLm60g4c='
WHERE
key_id = '1c8380f777947691ebd5bc1f2f7f61c85f69cd5798dd19d4fe01bfc5422d5d15'
AND (
token = 'QPVPwrZ3T5eKASEg5frbt68akKiyeSPMWoGLLm60g4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)