UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EW1DS4OOXwBFkZ9IoBNdLtZhUuYjaRFpPp+lN7gytBg='
WHERE
key_id = '8cd38536129a720bb34ee7386363c81eaf9b6df905153712fad13044f4a2e993'
AND (
token = 'EW1DS4OOXwBFkZ9IoBNdLtZhUuYjaRFpPp+lN7gytBg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)