UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mGO3Q++Yga8hkadaXprFYOG3Piu4Jk3we2qh8wMB1jk='
WHERE
key_id = 'f3f21a20ed47c94c270dba669d528a17dfadaa10e80ee94edf3dca8119189325'
AND (
token = 'mGO3Q++Yga8hkadaXprFYOG3Piu4Jk3we2qh8wMB1jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)