UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ran2Oatg8IlykuzbKMYH7YRlAfgeX2xEKzkFEqQULEg='
WHERE
key_id = 'df47ce5b8be6fabcc8953d43bc606a1f2163d79c80e1e47c29084d9ab662a8e4'
AND (
token = 'Ran2Oatg8IlykuzbKMYH7YRlAfgeX2xEKzkFEqQULEg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)