UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T2SyPtzcpfsl0R0aiVx+laLwfoG+gSanXf2DA8BULo4='
WHERE
key_id = 'd52404aed880371ee5cd4e51c4a7dc7b1e79057609515236cf3ea9e25ae17313'
AND (
token = 'T2SyPtzcpfsl0R0aiVx+laLwfoG+gSanXf2DA8BULo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)