UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sBqOqG5ficpr2BNZoFwel2YMV8s+gBt1rNYtQYs1UL0='
WHERE
key_id = '982ab289a3e1fc99930414bb1c9758e26abc9cee1b5ef4fe3b970eb09df1c4b7'
AND (
token = 'sBqOqG5ficpr2BNZoFwel2YMV8s+gBt1rNYtQYs1UL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)