UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z46ZuYc7duOsPmsr2fEsxpTWpW+XbJkdu5pQAVp1Q8k='
WHERE
key_id = '5ae0b7e1ed90ace7f868a8a11bd18d1a0cb5f4d3d55b73f2fcff5c665f0b9cfc'
AND (
token = 'z46ZuYc7duOsPmsr2fEsxpTWpW+XbJkdu5pQAVp1Q8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)