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