UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6R4rkrgFRvs/lXL+Ws0xF9E6LnA+sORETW2Hm1x0IFk='
WHERE
key_id = 'd97af14929ee7aacdfaedac9108367645869a18a6b3d8471b995cd97510d8da3'
AND (
token = '6R4rkrgFRvs/lXL+Ws0xF9E6LnA+sORETW2Hm1x0IFk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)